#ifndef __TASKQUEUE_H__
#define __TASKQUEUE_H__
#include <iostream>
#include <mutex>
#include <condition_variable>
#include <queue>
using namespace std;
class Task;
using ElemType = Task *;
class taskqueue
{
public:
    taskqueue(size_t capa);
    ~taskqueue();
    void push(ElemType val);
    ElemType pop();
    bool full() const;
    bool empty() const;
    void wakeup();

private:
    size_t _capacity;
    queue<ElemType> _que;
    mutex _mutex;
    condition_variable _notEmpty;
    condition_variable _notFull;
    bool _flag;
};
#endif